import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;

public class SocketClientDemo {
    public static void main(String[] args) {
        String serverIp = "124.221.147.54"; // 阿里云服务器IP
        int port = 8080; // 服务器监听的端口号

        try (Socket socket = new Socket(serverIp, port)) {
            // 创建输出流，向服务器发送信息
            OutputStream outputStream = socket.getOutputStream();
            PrintWriter writer = new PrintWriter(outputStream, true);

            // 发送消息
            String message = "汤晨铳好似金城武";
            writer.println(message);

            System.out.println("Message sent to server: " + message);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

